#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
int main(int argc ,char *argv[])
{
	int fd = open(argv[1],O_RDWR);
	if(fd < 0)
	{
		perror("open error\n");
		return -1;
	}
#if 0
	char c;
	int ret = read(fd,&c,1);
	if(ret < 0)
	{
		perror("read error\n");
	}else{
		printf("read char = %c\n",c);
	}
#else
	int i = 20;
	while (i--)
	{
		char data = '1';
		char a = '0';
		write(fd,&data,1);
		sleep(1);
		write(fd,&a,1);
		sleep(1);
	}



#endif	
	close(fd);
}
